package com.zhuanzhuan.hero.user.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zhuanzhuan.hero.user.dto.backend.RelateBusinessLabelDTO;
import com.zhuanzhuan.hero.user.entity.HeroLabelInfo;
import com.zhuanzhuan.hero.user.entity.HeroUserLabelRelation;
import com.zhuanzhuan.hero.user.pojo.bo.QueryUserLabelRelateBO;
import com.zhuanzhuan.hero.user.pojo.po.LabelInfoPO;
import com.zhuanzhuan.hero.user.pojo.po.QueryBusinessLabelRelatePO;
import com.zhuanzhuan.hero.user.vo.label.BatchRelateBusinessLabelVO;

import java.util.List;

/**
 * dal Interface:HeroUserLabelRelation
 * @author hanjunjun
 * @date 2024-6-21
 */
public interface HeroUserLabelRelationService extends IService<HeroUserLabelRelation> {

    /**
     * 查询用户已绑定的标签
     *
     * @param uid
     * @param labelType
     * @return java.util.List<com.zhuanzhuan.hero.user.entity.HeroUserLabelRelation>
     * @author  hanjunjun
     * @date 2024/6/24
     **/
    List<HeroUserLabelRelation> queryUserRealateLabels(Long uid, Integer labelType);

    /**
     * 从关联表查询标签信息
     *
     * @param uids
     * @param labelType
     * @return java.util.List<com.zhuanzhuan.hero.user.pojo.po.LabelInfoPO>
     * @author  hanjunjun
     * @date 2024/7/3
     **/
    List<LabelInfoPO> queryUserRealateLabelInfos(List<Long> uids, Integer labelType);

    /**
     * 根据uid和labelType删除记录
     *
     * @param uids
     * @param labelType
     * @return void
     * @author  hanjunjun
     * @date 2024/6/24
     **/
    void delByUidAndLabelType(List<Long> uids, Integer labelType, Long excludeLabelId);

    /**
     * 根据uids和labelId删除记录
     *  包含了经营标签变更发mq的逻辑
     * @param uids
     * @param labelInfo 取labelId
     * @param operaterUid
     * @return void
     * @author  hanjunjun
     * @date 2024/6/24
     **/
    void delByUidsAndLabelId(List<Long> uids, HeroLabelInfo labelInfo, Long operaterUid);

    /**
     * 根据uid和labelIds删除
     *
     * @param uid
     * @param labelIds
     * @param operaterUid
     * @return void
     * @author  hanjunjun
     * @date 2024/8/12
     **/
    void delByUidAndLabelIds(Long uid, List<Long> labelIds, Long operaterUid);

    /**
     * 根据labelId删除
     *
     * @param labelIds
     * @return void
     * @author  hanjunjun
     * @date 2024/6/25
     **/
    void delByLabelIds(List<Long> labelIds, Long operaterUid);

    /**
     * 将不生效更新为生效
     *
     * @param labelIds
     * @param operaterUid
     * @return void
     * @author  hanjunjun
     * @date 2024/7/1
     **/
    void effectiveByLabelIds(List<Long> labelIds, Long operaterUid);

    /**
     * 将生效更新为不生效
     *
     * @param labelIds
     * @param operaterUid
     * @return void
     * @author  hanjunjun
     * @date 2024/7/1
     **/
    void invalidByLabelIds(List<Long> labelIds, Long operaterUid);

    /**
     * 将单个标签标签关联到多个用户
     *
     * @param labelInfo
     * @param relateBusinessLabelDTO
     * @return void
     * @author  hanjunjun
     * @date 2024/7/1
     **/
    BatchRelateBusinessLabelVO labelRelateUsers(HeroLabelInfo labelInfo, RelateBusinessLabelDTO relateBusinessLabelDTO);

    /**
     * 用户关联运营标签变更 发送mq
     *
     * @param labelInfo
     * @param uids
     * @param boundType
     * @return void
     * @author  hanjunjun
     * @date 2024/7/11
     **/
    void sendLabelRelationUpdateMsg(HeroLabelInfo labelInfo, List<Long> uids, Integer boundType);

    /**
     * 一个用户关联多个标签
     *  删除旧的创建新的
     * @param uid
     * @param labelType
     * @param labelIds
     * @return void
     * @author  hanjunjun
     * @date 2024/7/3
     **/
    void userRelateLabels(Long uid, Integer labelType, List<Long> labelIds);

    /**
     * 查询标签关联给了哪些人
     *
     * @param labelId
     * @return java.util.List<com.zhuanzhuan.hero.user.pojo.po.QueryBusinessLabelRelatePO>
     * @author  hanjunjun
     * @date 2024/7/23
     **/
    List<QueryBusinessLabelRelatePO> queryLabelRelatedUsers(Long labelId);

    /**
     * 复杂查询
     *
     * @param queryUserLabelRelateBO
     * @return java.util.List<com.zhuanzhuan.hero.user.vo.backend.QueryBusinessLabelRelateVO>
     * @author  hanjunjun
     * @date 2024/7/1
     **/
    List<QueryBusinessLabelRelatePO> queryByParam(QueryUserLabelRelateBO queryUserLabelRelateBO);

    /**
     * 用户的同行认证标签 被认证数++
     *
     * @param labelIds
     * @return void
     * @author  hanjunjun  
     * @date 2024/7/3       
     **/
    void increCertifiedNum(Long uid, List<Long> labelIds);

    /**
     * 用户的同行认证标签 被认证数--
     *
     * @param uid
     * @param labelIds
     * @return void
     * @author  hanjunjun
     * @date 2024/7/3
     **/
    void decreCertifiedNum(Long uid, List<Long> labelIds);

    /**
     * 经营标签是否填写完成
     *
     * @param uid
     * @param managementLabelInfos
     * @return boolean
     * @author  hanjunjun
     * @date 2024/7/18
     **/
    boolean managementLabelIsPerfection(Long uid, List<LabelInfoPO> managementLabelInfos);
}